/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.gob.presidencia.cultura.espacios;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author edgardo
 */
@ManagedBean
@SessionScoped
public class SessionBean implements Serializable{
    private StringBuilder message = new StringBuilder("asa");
    private String headerMessage = "sdsa";
    private String imgUrl = "./../resources/images/ok.png";
    private List<String> lst = new ArrayList<String>();
    private boolean visible =false;

    public StringBuilder getMessage() {
        return message;
    }

    public boolean isVisible() {
        return visible;
    }

    public List<String> getLst() {
        lst.clear();
        lst.add("Servicios en otros idiomas");
        lst.add("Informacion turistica y cultura");
        lst.add("Wifi");
        lst.add("Actividades Artisticas");
        lst.add("Material Didactico");
        lst.add("Servicios en otros idiomas");
        lst.add("Informacion turistica y cultura");
        lst.add("Wifi");
        lst.add("Actividades Artisticas");
        lst.add("Material Didactico");
        return lst;
    }

    public void setLst(List<String> lst) {
        this.lst = lst;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public void setMessage(StringBuilder message) {
        this.message = message;
    }

    public String getHeaderMessage() {
        return headerMessage;
    }

    public void setHeaderMessage(String headerMessage) {
        this.headerMessage = headerMessage;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    
    /**
     * Creates a new instance of SessionBean
     */
    public SessionBean() {
    }
    
    public void alerta(String header, String mensaje, int nivel){
        if(nivel == 0){
            this.headerMessage = header;
            this.message = new StringBuilder(mensaje);
            this.imgUrl = "./../resources/images/ok.png";
            this.visible = true;
        }
        if(nivel == 1){
            this.headerMessage = header;
            this.message = new StringBuilder(mensaje);
            this.imgUrl = "./../resources/images/warning.png";
            this.visible = true;
        }
        if(nivel == 2){
            this.headerMessage = header;
            this.message = new StringBuilder(mensaje);
            this.imgUrl = "./../resources/images/error.png";
            this.visible = true;
        }
    }
    
    public void limpiarVistas(){
        FacesContext.getCurrentInstance().getViewRoot().getViewMap().clear();
    }
            
}
